﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlogsAPI.Sites.FoursquareSharp
{
    /// <summary>
    /// Отмечание
    /// </summary>
    /// <see cref="https://developer.foursquare.com/docs/responses/checkin"/>
    public class CheckIn
    {
        /// <summary>
        /// идентификатор 
        /// </summary>
        [JsonMapping("id", JsonMapping.MappingType.Primitive)]
        public string Id { get; set; }
        /// <summary>
        /// тип объекта One of checkin, shout, or venueless.
        /// </summary>
        [JsonMapping("type", JsonMapping.MappingType.Primitive)]
        public string Type { get; set; }
        /// <summary>
        /// Optional If present, it indicates the checkin was marked as private and not sent to friends. It is only being returned because the owner of the checkin is viewing this data.
        /// </summary>
        [JsonMapping("private", JsonMapping.MappingType.Primitive)]
        public bool Private { get; set; }
        /// <summary>
        /// Optional If the user is not clear from context, then a compact user is present.
        /// </summary>
        [JsonMapping("user", JsonMapping.MappingType.Class)]
        public User User { get; set; }
        /// <summary>
        /// Optional If the venue is not clear from context, and this checkin was at a venue, then a compact venue is present.
        /// </summary>
        [JsonMapping("venue", JsonMapping.MappingType.Class)]
        public Venue Venue { get; set; }
        /// <summary>
        /// Optional If the type of this checkin is shout or venueless, this field may be present and may contains a lat, lng pair and/or a name, providing unstructured information about the user's current location.
        /// </summary>
        [JsonMapping("location", JsonMapping.MappingType.Class)]
        public Location Location {
            get { return _location ?? Venue.Location; }
            set { _location = value; } 
        }

        protected Location _location;

        /// <summary>
        /// Optional Message from check-in, if present and visible to the acting user.
        /// </summary>
        [JsonMapping("shout", JsonMapping.MappingType.Primitive)]
        public string Shout { get; set; }
        /// <summary>
        /// Seconds since epoch when this checkin was created.
        /// </summary>
        [JsonMapping("createdAt", JsonMapping.MappingType.Primitive)]
        public DateTime CreatedAt { get; set; }
        /// <summary>
        /// Optional If present, the name and url for the application that created this checkin.
        /// </summary>
        [JsonMapping("source", JsonMapping.MappingType.Class)]
        public Source Source { get; set; }
        /// <summary>
        /// count and items for photos on this checkin. All items may not be present.
        /// </summary>
        [JsonMapping("photos", JsonMapping.MappingType.Class)]
        public Counter Photos { get; set; }
        /// <summary>
        /// count and items for comments on this checkin. All items may not be present.
        /// </summary>
        [JsonMapping("comments", JsonMapping.MappingType.Class)]
        public Counter Comments { get; set; }
        /// <summary>
        /// The count of users who have liked this checkin, and groups containing any friends and others who have liked it. The groups included are subject to change.
        /// </summary>
        [JsonMapping("likes", JsonMapping.MappingType.Class)]
        public Counter Likes { get; set; }
        /// <summary>
        /// Optional count and items of checkins from friends checked into the same venue around the same time.
        /// </summary>
        [JsonMapping("overlaps", JsonMapping.MappingType.Class)]
        public Counter Overlaps { get; set; }
        /// <summary>
        /// total and scores for this checkin
        /// </summary>
        //[JsonMapping("score", JsonMapping.MappingType.Class)]
        //public Score Score { get; set; }
        /// <summary>
        /// Have the user liked it
        /// </summary>
        [JsonMapping("like", JsonMapping.MappingType.Primitive)]
        public Boolean Like { get; set; }
    }
}
